 <%@page import="com.hrms.view.DiscussionView"%>
<%@page import="com.hrms.domain.Post"%>
<%@page import="java.util.Date"%>
<%@page import="com.hrms.core.Constants"%>
<%@page import="java.util.Arrays"%>
<%@page import="com.hrms.core.Utils"%>
<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="com.hrms.domain.Employee"%>
<%@page import="java.util.ArrayList"%>
<%@page import="com.hrms.domain.BusinessObjectImpl"%>
<%@page import="java.util.List"%>
<%@page import="com.google.appengine.api.datastore.KeyFactory"%>
<%@ taglib prefix="c" tagdir="/WEB-INF/tags"%>
<%

DiscussionView discussionView = new DiscussionView();
discussionView.service(request, response);

List<Post> genComments = discussionView.getUserPosts();
%>
<div style="width: 600px;">
<%@include file="/WEB-INF/include/msg.jsp" %>
<form id="Form<%= Post.TYPE %>" name="Form<%= Post.TYPE %>">
 <input type="hidden" name="<%= Constants.ACTION %>" id="<%= Constants.ACTION %>" value="<%= Constants.Action.NEW.toString() %>"/> 
            <div align="right">
            Posts from : 
             <input type="text" name="<%= DiscussionView.SELECTED_DATE %>" id="<%= DiscussionView.SELECTED_DATE %>" size="10" value="<%= Utils.formatToSimpleDate(discussionView.getSelectedDate()) %>">
			 		<script type="text/javascript">
  					$(document).ready(function(){
    						$("#<%= DiscussionView.SELECTED_DATE %>").datepicker({ showOn: 'button', buttonImageOnly: true, buttonImage: '/static/images/icon_cal.png' });
  					});
					</script> 
					<input type="button" onclick="javascript: reloadForEmployee();" value="Refresh" class="styledActionButton" title="Show All Posts Before this date">
			</div>
			<hr>		
					
              <div class="cards">        
                <textarea id="msg"  name="msg" cols="60%" rows="2" maxlength="480"  style="overflow-x: auto; overflow-y: auto;" ></textarea>
                <button type="button" class="styledActionButton"  onclick="saveItem('<%= Post.TYPE %>');" title="Post content to this wall"><font class="styledActionButton"> 
                share</font></button>
              </div>
                <br/>
   <%
    Integer no=0;
    if(!genComments.isEmpty()){
    for(Post c : genComments) { no++; 
    
    %>
    <hr>
	<div class="chat-bubble-2" align="left"> <b><%= c.getInitials() %></b> : 
	<%= c.getMsg() %>
	<div  class="timestamps" align="left"> @<%= Utils.formatDate(c.getDate()) %> </div>
	</div>
              <%}
    }else{ %>
              <div class="details">No Posts</div>
       <%} %>
</form>          
</div>  
<script type="text/javascript">
<!--
$('textarea#msg').autoResize({
    // On resize:
    onResize : function() {
        $(this).css({opacity:0.8});
    },
    // After resize:
    animateCallback : function() {
        $(this).css({opacity:1});
    },
    // Quite slow animation:
    animateDuration : 300,
    // More extra space:
    extraSpace : 40
});

stringFields.push("msg");
//-->
</script>
